import numpy as np
import pandas as pd


def data_p(x):
    x = np.reshape(x, (x.shape[0],))
    x_ = np.mean(x, axis=0)
    theta_x = np.sqrt(np.sum(np.power(x - x_, 2))) / np.sqrt(x.shape[0] - 1)
    M_x = np.zeros(x.shape)
    for i in range(x.shape[0]):
        if x[i] < (3 * theta_x) or x[i] > (-3 * theta_x):
            M_x[i] = 1
        else:
            print(i)
    return M_x


df = pd.read_csv('myhouse.csv', sep=',')
df.apply(pd.to_numeric, axis=0)
df.columns = ['size', 'rental']

x = df[['size']].values
y = df[['rental']].values

# s = np.array([x,y])
# s = s.reshape(2818,2)

# print (s.shape)
# print(y)
# index = np.correlate(s)
# print(index)

#
# Ma_x = data_p(x)
# Ma_y = data_p(y)
#
# print(Ma_x, Ma_y)

